Modelling change as average lambdas

All taxa in Canada

These are models to evaluate the relationship between average population change and body size, trophic level, and lifespan traits, while accounting for differences in System and Class, and including a random effect by Binomial because the trait data was collected at the species level.

# null model
m0 = lmer(avlambda ~ (1|Binomial), data = df)
m1 = lmer(avlambda ~ Class + (1|Binomial),  data = df)
m2 = lmer(avlambda ~ Class + System + (1|Binomial), data = df)
m3 = lmer(avlambda ~ System + (1|Binomial), data = df)

# adding traits

# body size only
# class should be in each model because body size is normalised within classes
m4 = lmer(avlambda ~ log10(BodySize) + Class + (1|Binomial),  data = df)
m5 = lmer(avlambda ~ log10(BodySize) + Class + System + (1|Binomial),  data = df)
m6 = lmer(avlambda ~ Class*log10(BodySize) + (1|Binomial),  data = df)
m7 = lmer(avlambda ~ System*log10(BodySize) + (1|Binomial),  data = df)

# trophic level only
m8 = lmer(avlambda ~ TrophicLevel + (1|Binomial),  data = df)
m9 = lmer(avlambda ~ TrophicLevel + Class + (1|Binomial),  data = df)
m10 = lmer(avlambda ~ TrophicLevel + System + (1|Binomial),  data = df)
m11 = lmer(avlambda ~ Class*TrophicLevel + (1|Binomial),  data = df)
m12 = lmer(avlambda ~ System*TrophicLevel + (1|Binomial),  data = df)

# lifespan only
m13 = lmer(avlambda ~ LifeSpan + (1|Binomial),  data = df)
m14 = lmer(avlambda ~ LifeSpan + Class + (1|Binomial),  data = df)
m15 = lmer(avlambda ~ LifeSpan + System + (1|Binomial),  data = df)
m16 = lmer(avlambda ~ Class*LifeSpan + (1|Binomial),  data = df)
m17 = lmer(avlambda ~ System*LifeSpan + (1|Binomial),  data = df)

# all three traits
m18 = lmer(avlambda ~ log10(BodySize) + TrophicLevel + Class + (1|Binomial),  data = df)
m19 = lmer(avlambda ~ log10(BodySize) + LifeSpan + Class + (1|Binomial),  data = df)
m20 = lmer(avlambda ~ TrophicLevel + LifeSpan + (1|Binomial),  data = df)
m21 = lmer(avlambda ~ log10(BodySize) + TrophicLevel + LifeSpan + Class + (1|Binomial),  data = df)

Model comparison

If we compare these models, their performance looks like…

compare_performance(m0, m1, m2, m3, # no traits
                    m4, m5, m6, m7, # body size
                    m8, m9, m10, m11, m12, # trophic level
                    m13, m14, m15, m16, m17, # lifespan
                    m18, m19, m20, m21, # variations of 2 or 3 traits
                    rank = TRUE) %>%
  kableExtra::kable() %>% kableExtra::kable_styling("striped")
## Warning: When comparing models, please note that probably not all models were fit from
##   same data.
Name Model AIC BIC R2_conditional R2_marginal ICC RMSE Sigma Performance_Score
m12 lmerMod -3471.333 -3409.507 0.0348805 0.0070550 0.0280232 0.1441810 0.1458388 0.7523561
m17 lmerMod -2792.812 -2745.157 0.0349758 0.0035132 0.0315735 0.1426739 0.1444300 0.6888471
m16 lmerMod -2754.346 -2682.864 0.0348728 0.0045354 0.0304756 0.1427100 0.1445135 0.6736751
m3 lmerMod -3731.612 -3700.451 0.0287336 0.0008569 0.0279006 0.1433590 0.1449232 0.6674856
m2 lmerMod -3698.554 -3642.465 0.0287815 0.0012209 0.0275943 0.1433705 0.1449900 0.6564232
m15 lmerMod -2821.070 -2785.329 0.0332686 0.0023704 0.0309716 0.1427849 0.1444749 0.6320734
m1 lmerMod -3716.499 -3672.874 0.0274099 0.0009377 0.0264971 0.1434913 0.1450286 0.6120387
m0 lmerMod -3749.237 -3730.540 0.0267208 0.0000000 0.0267208 0.1435183 0.1449990 0.5970885
m20 lmerMod -2757.545 -2721.942 0.0322490 0.0012710 0.0310174 0.1427699 0.1444624 0.5800903
m14 lmerMod -2806.674 -2759.019 0.0317655 0.0027432 0.0291021 0.1429363 0.1445953 0.5714136
m10 lmerMod -3470.791 -3427.513 0.0305401 0.0010498 0.0295212 0.1444546 0.1461239 0.5658540
m11 lmerMod -3427.721 -3341.165 0.0302009 0.0028472 0.0274318 0.1445485 0.1462566 0.5395836
m13 lmerMod -2838.051 -2814.223 0.0305789 0.0009854 0.0296227 0.1429702 0.1445652 0.5359904
m9 lmerMod -3457.900 -3402.257 0.0291023 0.0016257 0.0275214 0.1446090 0.1462301 0.5091172
m8 lmerMod -3487.907 -3456.994 0.0284186 0.0002494 0.0281762 0.1446264 0.1462037 0.4915707
m21 lmerMod -2613.681 -2548.729 0.0318966 0.0052128 0.0268237 0.1436640 0.1453068 0.4804742
m19 lmerMod -2690.376 -2637.026 0.0299372 0.0046017 0.0254526 0.1438789 0.1454150 0.4238949
m7 lmerMod -3300.138 -3250.908 0.0272120 0.0041042 0.0232031 0.1462725 0.1476922 0.2992112
m5 lmerMod -3285.099 -3223.563 0.0270297 0.0038099 0.0233085 0.1462965 0.1477618 0.2829731
m6 lmerMod -3272.807 -3198.964 0.0269604 0.0046568 0.0224079 0.1463353 0.1477959 0.2776651
m18 lmerMod -3222.168 -3160.820 0.0272654 0.0039784 0.0233801 0.1463165 0.1477873 0.2738092
m4 lmerMod -3302.971 -3253.742 0.0258020 0.0035489 0.0223323 0.1464042 0.1477872 0.2441688

“Best” model(s) evaluation

Let’s look at the top models!

Model 12 : avlambda ~ System*TrophicLevel + (1|Binomial)

check_model(m12)

plot_model(m12, type="pred")

Model 17: avlambda ~ System*LifeSpan + (1|Binomial)

check_model(m17)

plot_model(m17, type="pred")


Mammals in Canada

These are models to evaluate the relationship between average population change and body size, trophic level, and lifespan traits, while accounting for differences in System, and including a random effect by Binomial because the trait data was collected at the species level. The Class variable is not included in these models, because the data is subset within the Mammals class.

df_taxon = filter(df, Class == "Mammals")

# null model
m0 = lmer(avlambda ~ (1|Binomial), data = df_taxon)
m1 = lmer(avlambda ~ System + (1|Binomial), data = df_taxon)

# adding traits

# body size only
# class should be in each model because body size is normalised within classes
m2 = lmer(avlambda ~ log10(BodySize) + (1|Binomial),  data = df_taxon)
m3 = lmer(avlambda ~ log10(BodySize) + System + (1|Binomial),  data = df_taxon)
m4 = lmer(avlambda ~ System*log10(BodySize) + (1|Binomial),  data = df_taxon)

# trophic level only
m5 = lmer(avlambda ~ TrophicLevel + (1|Binomial),  data = df_taxon)
m6 = lmer(avlambda ~ TrophicLevel + System + (1|Binomial),  data = df_taxon)
m7 = lmer(avlambda ~ System*TrophicLevel + (1|Binomial),  data = df_taxon)

# lifespan only
m8 = lmer(avlambda ~ LifeSpan + (1|Binomial),  data = df_taxon)
m9 = lmer(avlambda ~ LifeSpan + System + (1|Binomial),  data = df_taxon)
m10 = lmer(avlambda ~ System*LifeSpan + (1|Binomial),  data = df_taxon)

# all three traits
m11 = lmer(avlambda ~ log10(BodySize) + TrophicLevel + (1|Binomial),  data = df_taxon)
m12 = lmer(avlambda ~ log10(BodySize) + LifeSpan + (1|Binomial),  data = df_taxon)
m13 = lmer(avlambda ~ TrophicLevel + LifeSpan + (1|Binomial),  data = df_taxon)
m14 = lmer(avlambda ~ log10(BodySize) + TrophicLevel + LifeSpan + (1|Binomial),  data = df_taxon)

Model comparison

compare_performance(m0, m1, # no traits
                    m2, m3, m4, # body size
                    m5, m6, m7, # trophic
                    m8, m9, m10, # lifespan
                    m11, m12, m13, m14, # combos of traits
                    rank = TRUE) %>%
  kableExtra::kable() %>% kableExtra::kable_styling("striped")
## Warning: When comparing models, please note that probably not all models were fit from
##   same data.
Name Model AIC BIC R2_conditional R2_marginal ICC RMSE Sigma Performance_Score
m0 lmerMod -549.5214 -536.8064 0.1411602 0.0000000 0.1411602 0.1288703 0.1333527 0.6628707
m1 lmerMod -537.0340 -515.8424 0.1440130 0.0018767 0.1424036 0.1288038 0.1334836 0.6254424
m5 lmerMod -523.0415 -501.9088 0.1546970 0.0042328 0.1511038 0.1291268 0.1339000 0.6093796
m7 lmerMod -509.8812 -476.0689 0.1567456 0.0145857 0.1442640 0.1291768 0.1341065 0.5550855
m6 lmerMod -513.1174 -483.5317 0.1552241 0.0141643 0.1430865 0.1292766 0.1340772 0.5549815
m13 lmerMod -494.5324 -469.2809 0.1644064 0.0055093 0.1597774 0.1293237 0.1342535 0.5398238
m10 lmerMod -478.5389 -444.8701 0.1662056 0.0094111 0.1582841 0.1292813 0.1343960 0.4818424
m9 lmerMod -497.5250 -472.2735 0.1578560 0.0052733 0.1533916 0.1295625 0.1344217 0.4620535
m11 lmerMod -514.8929 -489.5337 0.1468553 0.0149780 0.1338826 0.1297345 0.1342732 0.4471267
m8 lmerMod -508.3950 -491.5606 0.1522503 0.0001447 0.1521276 0.1297337 0.1344028 0.4469928
m3 lmerMod -515.4520 -490.0928 0.1441356 0.0054117 0.1394787 0.1297207 0.1343866 0.4012629
m4 lmerMod -506.7624 -472.9501 0.1470324 0.0094465 0.1388980 0.1296293 0.1344886 0.3857245
m2 lmerMod -528.0130 -511.1068 0.1372132 0.0054848 0.1324549 0.1300012 0.1343735 0.3814732
m14 lmerMod -490.8208 -461.3607 0.1518389 0.0303202 0.1253184 0.1302834 0.1346906 0.3441005
m12 lmerMod -503.7635 -482.7205 0.1416670 0.0251471 0.1195255 0.1307862 0.1349347 0.2500098

“Best” model(s) evaluation

The two best models are two of the null options (m0 and m1). However, let’s take a look at the best model with traits included:

Model 5: avlambda ~ TrophicLevel + (1|Binomial)

check_model(m5)

plot_model(m5, type="pred")

plot_model(m5, type="re")
## Warning in checkMatrixPackageVersion(): Package version inconsistency detected.
## TMB was built with Matrix version 1.2.18
## Current Matrix version is 1.3.2
## Please re-install 'TMB' from source using install.packages('TMB', type = 'source') or ask CRAN for a binary version of 'TMB' matching CRAN's 'Matrix' package

Birds in Canada

bird_df = filter(df, Class == "Birds")

# null model
m0_b = lmer(avlambda ~ (1|Binomial), data = bird_df)
m1_b = lmer(avlambda ~ System + (1|Binomial), data = bird_df)

# adding traits

# body size only
# class should be in each model because body size is normalised within classes
m2_b = lmer(avlambda ~ log10(BodySize) + (1|Binomial),  data = bird_df)
m3_b = lmer(avlambda ~ log10(BodySize) + System + (1|Binomial),  data = bird_df)
m4_b = lmer(avlambda ~ System*log10(BodySize) + (1|Binomial),  data = bird_df)

# trophic level only
m5_b = lmer(avlambda ~ TrophicLevel + (1|Binomial),  data = bird_df)
m6_b = lmer(avlambda ~ TrophicLevel + System + (1|Binomial),  data = bird_df)
m7_b = lmer(avlambda ~ System*TrophicLevel + (1|Binomial),  data = bird_df)

# lifespan only
m8_b = lmer(avlambda ~ LifeSpan + (1|Binomial),  data = bird_df)
m9_b = lmer(avlambda ~ LifeSpan + System + (1|Binomial),  data = bird_df)
m10_b = lmer(avlambda ~ System*LifeSpan + (1|Binomial),  data = bird_df)

# all three traits
m11_b = lmer(avlambda ~ log10(BodySize) + TrophicLevel + (1|Binomial),  data = df)
m12_b = lmer(avlambda ~ log10(BodySize) + LifeSpan + (1|Binomial),  data = df)
m13_b = lmer(avlambda ~ TrophicLevel + LifeSpan + (1|Binomial),  data = df)
m14_b = lmer(avlambda ~ log10(BodySize) + TrophicLevel + LifeSpan + (1|Binomial),  data = df)

Modelling change as summed lambdas

All taxa in Canada

These are models to evaluate the relationship between summed population change and body size, trophic level, and lifespan traits, while accounting for differences in System and Class, and including a random effect by Binomial because the trait data was collected at the species level.

# null model
m0 = lmer(sumlambda ~ (1|Binomial), data = df)
m1 = lmer(sumlambda ~ Class + (1|Binomial),  data = df)
m2 = lmer(sumlambda ~ Class + System + (1|Binomial), data = df)
m3 = lmer(sumlambda ~ System + (1|Binomial), data = df)

# adding traits

# body size only
# class should be in each model because body size is normalised within classes
m4 = lmer(sumlambda ~ log10(BodySize) + Class + (1|Binomial),  data = df)
m5 = lmer(sumlambda ~ log10(BodySize) + Class + System + (1|Binomial),  data = df)
m6 = lmer(sumlambda ~ Class*log10(BodySize) + (1|Binomial),  data = df)
m7 = lmer(sumlambda ~ System*log10(BodySize) + (1|Binomial),  data = df)

# trophic level only
m8 = lmer(sumlambda ~ TrophicLevel + (1|Binomial),  data = df)
m9 = lmer(sumlambda ~ TrophicLevel + Class + (1|Binomial),  data = df)
m10 = lmer(sumlambda ~ TrophicLevel + System + (1|Binomial),  data = df)
m11 = lmer(sumlambda ~ Class*TrophicLevel + (1|Binomial),  data = df)
m12 = lmer(sumlambda ~ System*TrophicLevel + (1|Binomial),  data = df)

# lifespan only
m13 = lmer(sumlambda ~ LifeSpan + (1|Binomial),  data = df)
m14 = lmer(sumlambda ~ LifeSpan + Class + (1|Binomial),  data = df)
m15 = lmer(sumlambda ~ LifeSpan + System + (1|Binomial),  data = df)
m16 = lmer(sumlambda ~ Class*LifeSpan + (1|Binomial),  data = df)
m17 = lmer(sumlambda ~ System*LifeSpan + (1|Binomial),  data = df)

# all three traits
m18 = lmer(sumlambda ~ log10(BodySize) + TrophicLevel + Class + (1|Binomial),  data = df)
m19 = lmer(sumlambda ~ log10(BodySize) + LifeSpan + Class + (1|Binomial),  data = df)
m20 = lmer(sumlambda ~ TrophicLevel + LifeSpan + (1|Binomial),  data = df)
m21 = lmer(sumlambda ~ log10(BodySize) + TrophicLevel + LifeSpan + Class + (1|Binomial),  data = df)

Model comparison

compare_performance(m0, m1, m2, m3, # no traits
                    m4, m5, m6, m7, # body size
                    m8, m9, m10, m11, m12, # trophic level
                    m13, m14, m15, m16, m17, # lifespan
                    m18, m19, m20, m21, # variations of 2 or 3 traits
                    rank = TRUE) %>%
  kableExtra::kable() %>% kableExtra::kable_styling("striped")
## Warning: When comparing models, please note that probably not all models were fit from
##   same data.
Name Model AIC BIC R2_conditional R2_marginal ICC RMSE Sigma Performance_Score
m16 lmerMod 6376.356 6447.838 0.0665717 0.0064608 0.0605018 0.6977831 0.7119186 0.7196103
m17 lmerMod 6360.918 6408.572 0.0627175 0.0008909 0.0618817 0.6987492 0.7127078 0.6164511
m6 lmerMod 7760.249 7834.093 0.0734884 0.0122347 0.0620123 0.7016527 0.7160363 0.6019007
m15 lmerMod 6336.955 6372.695 0.0619861 0.0008342 0.0612029 0.6989648 0.7126275 0.5967293
m5 lmerMod 7760.774 7822.311 0.0710344 0.0063285 0.0651179 0.7013223 0.7160387 0.5698705
m14 lmerMod 6340.556 6388.210 0.0619312 0.0038015 0.0583515 0.6994548 0.7128648 0.5653431
m13 lmerMod 6325.217 6349.044 0.0605572 0.0001751 0.0603926 0.6993653 0.7127182 0.5531546
m7 lmerMod 7756.205 7805.434 0.0705062 0.0071099 0.0638504 0.7020064 0.7163620 0.5361829
m19 lmerMod 6203.591 6256.940 0.0642275 0.0049475 0.0595747 0.7036364 0.7174127 0.5198299
m4 lmerMod 7756.064 7805.293 0.0688072 0.0046146 0.0644902 0.7022377 0.7167044 0.4922066
m2 lmerMod 8360.651 8416.741 0.0681914 0.0047898 0.0637067 0.6992112 0.7138467 0.4792475
m3 lmerMod 8350.202 8381.363 0.0666924 0.0013028 0.0654749 0.6994455 0.7140692 0.4517340
m21 lmerMod 6110.243 6175.194 0.0653884 0.0042829 0.0613683 0.7076786 0.7220650 0.4460105
m20 lmerMod 6229.200 6264.803 0.0608673 0.0004804 0.0604160 0.7039343 0.7175762 0.4376913
m18 lmerMod 7659.701 7721.049 0.0696984 0.0040625 0.0659037 0.7056040 0.7205506 0.4310076
m1 lmerMod 8354.269 8397.894 0.0663379 0.0032472 0.0632962 0.6998790 0.7143003 0.4185947
m0 lmerMod 8340.134 8358.830 0.0653581 0.0000000 0.0653581 0.6997572 0.7142213 0.4150121
m11 lmerMod 8050.733 8137.289 0.0686179 0.0032504 0.0655807 0.7065395 0.7218317 0.3206009
m12 lmerMod 8036.065 8097.891 0.0681283 0.0025800 0.0657178 0.7064515 0.7214568 0.3199433
m10 lmerMod 8030.634 8073.912 0.0670511 0.0012069 0.0659237 0.7068279 0.7216151 0.2901060
m9 lmerMod 8034.258 8089.901 0.0673162 0.0029959 0.0645135 0.7069394 0.7216627 0.2837886
m8 lmerMod 8019.766 8050.679 0.0654089 0.0004787 0.0649614 0.7073418 0.7218211 0.2371558

“Best” model(s) evaluation

Model 16: sumlambda ~ Class*LifeSpan + (1|Binomial)

check_model(m16)

plot_model(m16, type="pred")

Model 17: sumlambda ~ System*LifeSpan + (1|Binomial)

check_model(m17)

plot_model(m17, type="pred")